define([
    'modules/ApiClient',
	'modules/config',
    "jquery",
    'jquery.cookie'
], function (ApiClient,config, $){
	var ersinit = function(tid){
        
		var url = config.ERSWEBAPI+'init/'+tid;
		alert(url);
		ApiClient.get(url,'').then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
    };
	
	var AllCode = function(stoken){
		var url = config.ERSWEBAPI+'Code';
		alert(url);
		ApiClient.get(url,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
	};
	
	var BoundaryData = function(tid,stoken){
        
		var url = config.ERSWEBAPI+'BoundaryData/'+tid;
		alert(url);
		ApiClient.get(url,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
    };
	
	var DynamicVerification = function(tid,stoken){
        
		var url = config.ERSWEBAPI+'DynamicVerification/'+tid;
		alert(url);
		ApiClient.get(url,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
    };
	
	var VerificationDisaster = function(tid,stoken){
        
		var url = config.ERSWEBAPI+'VerificationDisaster/'+tid;
		alert(url);
		ApiClient.get(url,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
    };
	
	var TypeVerification = function(tid,stoken){
        
		var url = config.ERSWEBAPI+'TypeVerification/'+tid;
		alert(url);
		ApiClient.get(url,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
    };
	
	var VegetationCoverage = function(tid,stoken){
        //VegetationCoverage
		//VegetationCoverage
		var url = config.ERSWEBAPI+'VegetationCoverage/'+tid;
		alert(url);
		ApiClient.get(url,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
    };
	
	var CalculationEIIndexList = function(stoken){
		var url = config.ERSWEBAPI+'EIIndex';
		alert(url);
		ApiClient.get(url,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
    };
	var CalculationEIIndex = function(tid,stoken){
		var url = config.ERSWEBAPI+'EIIndex';
		alert(url);
		var json_params={
			syear:tid
		}
		ApiClient.post(url,json_params,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
						alert(reValues.data.reRows);
						alert(reValues.data.reMessage);
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
		
    };
	
	var EIIndexList =  function(tid,stoken){
		var url = config.ERSWEBAPI+'EIIndex/'+tid;
		alert(url);
		ApiClient.get(url,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
    };
	
	var EIIndexChangeList =  function(sYear,eYear,stoken){
		var url = config.ERSWEBAPI+'EIIndex';
		alert(url);
		var json_params={
			StartYear:sYear,
			EndYear:eYear
		}
		ApiClient.getparams(url,json_params,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
    };
	
	var getEIParams = function(sYear,stoken){
		var url = config.ERSWEBAPI+'EIParams/'+sYear;
		alert(url);
		ApiClient.get(url,stoken).then(function (reValues) {
					console.log(reValues);
					alert(reValues.data.code);
					if (reValues.data.code == "200") {
                
					} else if (reValues.data.code == "401") {
                
					} else {
					
					}
				});
	};
	
	return {
		ersinit:ersinit,
		AllCode:AllCode,
		BoundaryData:BoundaryData,
		DynamicVerification:DynamicVerification,
		VerificationDisaster:VerificationDisaster,
		TypeVerification:TypeVerification,
		VegetationCoverage:VegetationCoverage,
		CalculationEIIndexList:CalculationEIIndexList,
		CalculationEIIndex:CalculationEIIndex,
		EIIndexList:EIIndexList,
		EIIndexChangeList:EIIndexChangeList,
		getEIParams:getEIParams
    }
})